<?php

namespace App\Services;

use App\Models\DataDict;

class DictService
{
    public static function getList($categoryCode = '', $districtId = null)
    {
        $query = DataDict::query()->where(['status' => DataDict::STATUS_ENABLED])->orderBy('order', 'asc');
        if ($categoryCode) {
            $query->where('category_code', $categoryCode);
        }
        if ($districtId) {
            $query->where('district_id', $districtId);
        }
        return $query->get();
    }
}
